import {createWebHashHistory, createRouter} from 'vue-router'
import Detail from '../components/Detail.vue'
import List from '../components/List.vue'
import Home from '../components/Home.vue'

const router = createRouter({
    history: createWebHashHistory(),
    routes: [
        {
            path: '/list',
            component: List
        },
        {
            path: '/detail',
            component: Detail
        },
        {
            path: '/home',
            components: {
                homeView: Home,
                default: Home
            }
        }
    ]
})

router.beforeEach((to, from, next) => {
    console.log('执行beforeEach函数')
    next()
})

router.afterEach((to, from) => {
    console.log('执行afterEach函数')
})


export default router